﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace HelfenHelfen.RIA.Controls
{
    public class ContextMenuDialog : Dialog
    {
        public event EventHandler OnCopySelected;

        public ContextMenuDialog()
        {
        }

        protected override void OnClickOutside()
        {
            Close();
        }

        protected override FrameworkElement GetContent()
        {
            Grid grid = new Grid() { Width = 100, Height = 27 };
            Border border = new Border() { BorderBrush = new SolidColorBrush(Colors.Black), BorderThickness = new Thickness(1), Background = new SolidColorBrush(Colors.LightGray) };
            grid.Children.Add(border);

            TextBlock copy = new TextBlock() { Text = "Copy", Width = 90 };
            copy.MouseLeftButtonUp += new MouseButtonEventHandler(copy_MouseLeftButtonUp);

            ListBox options = new ListBox();
            options.Items.Add(copy);

            grid.Children.Add(options);

            return grid;
        }

        void copy_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            EventHandler h = OnCopySelected;
            h(sender, new EventArgs());
            Close();
        }

        void CancelContextMenu(object sender, MouseButtonEventArgs e)
        {
            Close();
        }
    }
}
